load("@fbcode//buck2/tests/prelude:py_assertion.bzl", "py_assertion")

# Test that the sources can be used in `exe`

oncall("build_infra")

prelude = native

prelude.command_alias(
    name = "foo",
    env = {"FOO": "hello-world"},
    exe = select({
        "DEFAULT": "foo.sh",
        "ovr_config//os:windows": "foo.bat",
    }),
)

py_assertion(
    name = "check",
    script = """
import subprocess
import sys
assert "hello-world" in subprocess.check_output([sys.argv[1]]).decode()
""",
    script_args = ["$(exe_target :foo)"],
)
